package Baitap01;

public abstract class Models implements IGeometricObject{

	public double getArea(Object obj, short shOpt) {
		double result =0;
		switch (shOpt) {
   
        case 0: {
            Triangle_Entity objEntity = (Triangle_Entity) obj;
            result = objEntity.Area(objEntity); } 
        break;
            
        case 1: {
            Rectangle_Entity objEntity = (Rectangle_Entity) obj;
            result = objEntity.Area(objEntity);
            } break;
        case 2: {
        	Parallelogram_Entity objEntity = (Parallelogram_Entity) obj;
        	result = objEntity.Area(objEntity);
        }
    }
		return result;
	}

	public double getPerimeter(Object obj, short shOpt) {
		double result =0;
		switch (shOpt) {
   
        case 0: {
            Triangle_Entity objEntity = (Triangle_Entity) obj;
            result = objEntity.Perimetter(objEntity); } 
        break;
            
        case 1: {
            Rectangle_Entity objEntity = (Rectangle_Entity) obj;
            result = objEntity.Perimetter(objEntity);
            } break;
        case 2: {
        	Parallelogram_Entity objEntity = (Parallelogram_Entity) obj;
        	result = objEntity.Perimeter(objEntity);
        }
    }
		return result;
	}

}
